package com.cskaoyan.controller.wx.catalog;

import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.common.CommonData;
import com.cskaoyan.bean.vo.wx.catalog.WxCurrentCatalogVo;
import com.cskaoyan.service.wx.catalog.WxCatalogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: erdonc
 * @date: 2022/9/11 15:50
 * TODO:
 */
@RestController
@RequestMapping("wx/catalog")
public class WxCatalogController {

    @Autowired
    WxCatalogService catalogService;


    /**
     * @Author: erdonc
     * @date : 2022/9/11 16:44
     * TODO: 点开分类图标显示分类信息和商品信息
     * Request URL: http://182.92.235.201:8083/wx/catalog/index
     */
    @RequestMapping("index")
    public BaseRespVo index() {
        WxCurrentCatalogVo catalogVo = catalogService.index();
        return BaseRespVo.ok(catalogVo);
    }

    /**
     * @Author: erdonc
     * @date : 2022/9/11 16:41
     * TODO: 根据页面请求id，获取当前分类信息
     * Request URL: http://182.92.235.201:8083/wx/catalog/current?id=1010000
     */
    @RequestMapping("current")
    public BaseRespVo current(Integer id) {
        WxCurrentCatalogVo catalogVo = catalogService.current(id);
        return BaseRespVo.ok(catalogVo);
    }


}
